package main

import (
	"crypto/md5"
	"encoding/hex"
	"fmt"
	"io"
)

func main() {
	h := md5.New()

	//加密 字符串

	io.WriteString(h, "The fog is getting thicker!")
	io.WriteString(h, "And Leon's getting laaarger!")

	////var b  = []byte{'a', 'b', 'c'}
	//e2c569be17396eca2a2e3c11578123ed
	//<1>
	s := hex.EncodeToString(h.Sum(nil))

	fmt.Printf("%s,长度 %d\n", s, len(s))
	//<2>

	h2 := md5.New()
	h2.Write([]byte(`The fog is getting thicker!`))
	h2.Write([]byte(`And Leon's getting laaarger!`))

	s2 := hex.EncodeToString(h.Sum(nil))
	//e2c569be17396eca2a2e3c11578123ed,长度 32
	fmt.Printf("%s,长度 %d\n", s2, len(s2))
}
